<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <title>JISPA 服务菜单</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: Arial, sans-serif;
            background: #000;
            overflow: hidden;
            height: 100vh;
            touch-action: manipulation;
        }

        .container {
            width: 100vw;
            height: 100vh;
            position: relative;
            overflow: hidden;
        }

        .slider {
            width: 200%;
            height: 100%;
            display: flex;
            transition: transform 0.3s ease-out;
            touch-action: pan-x;
        }

        .slide {
            width: 50%;
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
            position: relative;
        }

        .slide img {
            width: 100%;
            height: 100%;
            object-fit: contain;
            user-select: none;
            -webkit-user-select: none;
            pointer-events: none;
        }

        /* 导航箭头 */
        .arrow {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            width: 60px;
            height: 60px;
            background: rgba(0, 0, 0, 0.7);
            border: 2px solid rgba(255, 255, 255, 0.8);
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            z-index: 100;
            color: white;
            font-size: 24px;
            font-weight: bold;
            transition: all 0.3s ease;
            touch-action: manipulation;
            -webkit-tap-highlight-color: transparent;
        }

        .arrow:hover, .arrow:active {
            background: rgba(0, 0, 0, 0.9);
            transform: translateY(-50%) scale(1.1);
        }

        .arrow.left {
            left: 20px;
        }

        .arrow.right {
            right: 20px;
        }

        /* 导航指示器 */
        .navigation {
            position: absolute;
            bottom: 30px;
            left: 50%;
            transform: translateX(-50%);
            display: flex;
            gap: 15px;
            z-index: 100;
        }

        .nav-dot {
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.5);
            border: 2px solid rgba(255, 255, 255, 0.8);
            cursor: pointer;
            transition: all 0.3s ease;
            touch-action: manipulation;
            -webkit-tap-highlight-color: transparent;
        }

        .nav-dot.active {
            background: rgba(255, 255, 255, 0.9);
            transform: scale(1.2);
        }

        /* 页面指示器 */
        .page-indicator {
            position: absolute;
            top: 30px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 10px 20px;
            border-radius: 25px;
            font-size: 16px;
            z-index: 100;
            border: 1px solid rgba(255, 255, 255, 0.3);
        }

        /* 平板和手机优化 */
        @media (max-width: 1024px) {
            .arrow {
                width: 50px;
                height: 50px;
                font-size: 20px;
            }

            .arrow.left {
                left: 15px;
            }

            .arrow.right {
                right: 15px;
            }

            .navigation {
                bottom: 20px;
            }

            .nav-dot {
                width: 14px;
                height: 14px;
            }

            .page-indicator {
                top: 20px;
                font-size: 14px;
                padding: 8px 16px;
            }
        }

        /* 加载动画 */
        .loading {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: white;
            font-size: 18px;
            z-index: 1000;
        }

        .spinner {
            width: 40px;
            height: 40px;
            border: 4px solid rgba(255, 255, 255, 0.3);
            border-top: 4px solid white;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 0 auto 15px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* 防止长按菜单 */
        img {
            -webkit-touch-callout: none;
            -webkit-user-select: none;
            -khtml-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
        }
    </style>
</head>
<body>
    <div class="loading" id="loading">
        <div class="spinner"></div>
        正在加载...
    </div>

    <div class="container">
        <div class="page-indicator">
            <span id="current-page">中文菜单</span>
        </div>

        <div class="slider" id="slider">
            <div class="slide">
                <img src="微信图片_2025-08-09_190215_816.jpg" alt="JISPA 中文服务菜单" id="img1">
            </div>
            <div class="slide">
                <img src="微信图片_2025-08-09_190221_383.jpg" alt="JISPA English Service Menu" id="img2">
            </div>
        </div>

        <div class="arrow left" id="prevBtn">‹</div>
        <div class="arrow right" id="nextBtn">›</div>

        <div class="navigation">
            <div class="nav-dot active" data-slide="0"></div>
            <div class="nav-dot" data-slide="1"></div>
        </div>
    </div>

    <script>
        class ImageSlider {
            constructor() {
                this.currentSlide = 0;
                this.totalSlides = 2;
                this.slider = document.getElementById('slider');
                this.dots = document.querySelectorAll('.nav-dot');
                this.pageIndicator = document.getElementById('current-page');
                this.loading = document.getElementById('loading');
                
                // 触摸相关变量
                this.startX = 0;
                this.endX = 0;
                this.startY = 0;
                this.isDragging = false;
                this.isScrolling = false;

                this.init();
                this.checkImagesLoaded();
            }

            init() {
                // 导航点击事件
                this.dots.forEach((dot, index) => {
                    dot.addEventListener('click', () => this.goToSlide(index));
                });

                // 箭头按钮事件
                document.getElementById('prevBtn').addEventListener('click', () => this.prevSlide());
                document.getElementById('nextBtn').addEventListener('click', () => this.nextSlide());

                // 触摸事件 - 针对平板优化
                this.slider.addEventListener('touchstart', (e) => this.handleTouchStart(e), { passive: false });
                this.slider.addEventListener('touchmove', (e) => this.handleTouchMove(e), { passive: false });
                this.slider.addEventListener('touchend', (e) => this.handleTouchEnd(e), { passive: false });

                // 鼠标事件（桌面支持）
                this.slider.addEventListener('mousedown', (e) => this.handleMouseDown(e));
                this.slider.addEventListener('mousemove', (e) => this.handleMouseMove(e));
                this.slider.addEventListener('mouseup', (e) => this.handleMouseUp(e));
                this.slider.addEventListener('mouseleave', (e) => this.handleMouseUp(e));

                // 键盘支持
                document.addEventListener('keydown', (e) => this.handleKeydown(e));

                // 防止右键菜单
                this.slider.addEventListener('contextmenu', (e) => e.preventDefault());
                
                // 防止双击缩放
                this.preventDoubleClickZoom();
            }

            handleTouchStart(e) {
                this.startX = e.touches[0].clientX;
                this.startY = e.touches[0].clientY;
                this.isDragging = true;
                this.isScrolling = false;
                this.slider.style.transition = 'none';
            }

            handleTouchMove(e) {
                if (!this.isDragging) return;
                
                const currentX = e.touches[0].clientX;
                const currentY = e.touches[0].clientY;
                const deltaX = Math.abs(currentX - this.startX);
                const deltaY = Math.abs(currentY - this.startY);
                
                // 判断是水平还是垂直滑动
                if (!this.isScrolling) {
                    this.isScrolling = true;
                    if (deltaX > deltaY) {
                        // 水平滑动 - 阻止默认行为
                        e.preventDefault();
                    } else {
                        // 垂直滑动 - 允许默认行为，停止处理
                        this.isDragging = false;
                        return;
                    }
                } else if (deltaX > deltaY) {
                    // 继续水平滑动
                    e.preventDefault();
                }
            }

            handleTouchEnd(e) {
                if (!this.isDragging) return;
                
                this.endX = e.changedTouches[0].clientX;
                this.handleSwipe();
                this.isDragging = false;
                this.isScrolling = false;
                this.slider.style.transition = 'transform 0.3s ease-out';
            }

            handleMouseDown(e) {
                this.startX = e.clientX;
                this.startY = e.clientY;
                this.isDragging = true;
                this.slider.style.cursor = 'grabbing';
                this.slider.style.transition = 'none';
                e.preventDefault();
            }

            handleMouseMove(e) {
                if (!this.isDragging) return;
                e.preventDefault();
            }

            handleMouseUp(e) {
                if (!this.isDragging) return;
                
                this.endX = e.clientX;
                this.handleSwipe();
                this.isDragging = false;
                this.slider.style.cursor = 'grab';
                this.slider.style.transition = 'transform 0.3s ease-out';
            }

            handleSwipe() {
                const threshold = 50; // 最小滑动距离
                const distance = this.startX - this.endX;
                
                if (Math.abs(distance) > threshold) {
                    if (distance > 0) {
                        // 向左滑动 - 下一张
                        this.nextSlide();
                    } else {
                        // 向右滑动 - 上一张
                        this.prevSlide();
                    }
                }
            }

            handleKeydown(e) {
                switch(e.key) {
                    case 'ArrowLeft':
                        this.prevSlide();
                        break;
                    case 'ArrowRight':
                        this.nextSlide();
                        break;
                }
            }

            goToSlide(index) {
                if (index < 0 || index >= this.totalSlides) return;
                
                this.currentSlide = index;
                this.updateSlider();
                this.updateNavigation();
            }

            nextSlide() {
                this.currentSlide = (this.currentSlide + 1) % this.totalSlides;
                this.updateSlider();
                this.updateNavigation();
            }

            prevSlide() {
                this.currentSlide = (this.currentSlide - 1 + this.totalSlides) % this.totalSlides;
                this.updateSlider();
                this.updateNavigation();
            }

            updateSlider() {
                const translateX = -this.currentSlide * 50;
                this.slider.style.transform = `translateX(${translateX}%)`;
            }

            updateNavigation() {
                // 更新导航点
                this.dots.forEach((dot, index) => {
                    dot.classList.toggle('active', index === this.currentSlide);
                });

                // 更新页面指示器
                this.pageIndicator.textContent = this.currentSlide === 0 ? '中文菜单' : 'English Menu';
            }

            checkImagesLoaded() {
                const images = document.querySelectorAll('img');
                let loadedCount = 0;

                const checkComplete = () => {
                    loadedCount++;
                    if (loadedCount === images.length) {
                        this.loading.style.display = 'none';
                    }
                };

                images.forEach(img => {
                    if (img.complete) {
                        checkComplete();
                    } else {
                        img.addEventListener('load', checkComplete);
                        img.addEventListener('error', () => {
                            console.error('图片加载失败:', img.src);
                            checkComplete();
                        });
                    }
                });

                // 5秒后强制隐藏加载画面
                setTimeout(() => {
                    this.loading.style.display = 'none';
                }, 5000);
            }

            preventDoubleClickZoom() {
                let lastTouchEnd = 0;
                document.addEventListener('touchend', function (event) {
                    const now = (new Date()).getTime();
                    if (now - lastTouchEnd <= 300) {
                        event.preventDefault();
                    }
                    lastTouchEnd = now;
                }, false);
            }
        }

        // 页面加载完成后初始化
        document.addEventListener('DOMContentLoaded', () => {
            new ImageSlider();
        });

        // 阻止页面缩放
        document.addEventListener('gesturestart', function (e) {
            e.preventDefault();
        });

        document.addEventListener('gesturechange', function (e) {
            e.preventDefault();
        });

        document.addEventListener('gestureend', function (e) {
            e.preventDefault();
        });
    </script>
</body>
</html> 